package com.edu.neusoft.student.domain;

import java.util.Date;
import lombok.Data;

import javax.validation.constraints.*;

@Data
public class Student {
    private Integer studentId;

    @NotNull(message = "名字不能为空")
    @Size(min = 1, max = 50, message = "名字的长度必须在1到50个字符之间")
    private String name;

    @NotNull(message = "性别不能为空")
    @Pattern(regexp = "^[男女]$", message = "性别必须是男或女")
    private String gender;

    @Past(message = "出生日期必须是过去的日期")
    private Date dateOfBirth;

    @NotNull(message = "电子邮件不能为空")
    @Email(message = "电子邮件格式不正确")
    @Size(max = 100, message = "电子邮件的长度不能超过100个字符")
    private String email;

    @Size(max = 15, message = "联系电话的长度不能超过15个字符")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话只能包含数字")
    private String phone;

    @Size(max = 255, message = "住址的长度不能超过255个字符")
    private String address;

    @NotNull(message = "入学日期不能为空")
    @Past(message = "入学日期必须是过去的日期")
    private Date enrollmentDate;

    private Date createdAt;
    private Date updatedAt;
}